let mongoose = require("mongoose");
mongoose.connect("mongodb://localhost:27017/newQY",{
    useNewUrlParser:true,
    useUnifiedTopology:true
}).then(()=>{
    console.log("积分 - 集合连接成功！");
}).catch(()=>{
    console.log("积分 - 集合连接失败！");
})
let schema = mongoose.Schema;
let integrals = new schema({
    // 用户
    user:{
        type:String,
        required:true
    },
    // 改变的积分
    changeIntegral:[
        {type:String}
    ],
    // 当前总积分
    total:[{
        type:Number,
        required:true
    }],
    // 改变时间
    time:[{
        type:String,
        required:true
    }],
    // 改变原因
    caseOf:[{
        type:String
    }]
})
let integralAward = mongoose.model("integral",integrals)
module.exports = {
    integralAward
}